﻿using System;
using System.Collections;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using ShevaEngine.Core.Modules.Graphics.Cameras;

namespace ShevaEngine.Core.Modules.Scenes
{
    /// <summary>
    /// Scene node switch.
    /// </summary>
    public class SceneNodeSwitch : SceneNode
    {
        /// <summary>Current mask.</summary>
        public Int32 CurrentMask;
        /// <summary>Masks.</summary>
        public List<BitArray> Masks;

        /// <summary>
        /// Constructor.
        /// </summary>
        public SceneNodeSwitch()
             : base()
        {
            this.Masks = new List<BitArray>();
        }

        /// <summary>
        /// Add in rendering pipeline.
        /// </summary>
        /// <param name="renderingPipeline"></param>
        /// <param name="camera"></param>
        /// <param name="worldMatrix"></param>
        public override bool AddInRenderingPipeline(Graphics.RenderingPipeline renderingPipeline, Camera camera, Matrix worldMatrix)
        {
            for (int i = 0; i < this.Count; i++)
                if (this.Masks[this.CurrentMask].Get(i))
                    this[i].AddInRenderingPipeline(renderingPipeline, camera, worldMatrix);

            return false;
        }
    }
}
